#ifndef OLDGUY_H
#define OLDGUY_H

#include "Bullet.h"
#include <QFileInfo>
#include <QMainWindow>
#include <QGraphicsItem>
#include <QGraphicsScene>
#include <QMap>
#include <QPainter>
#include <QList>
#include <QPointF>
#include <QPixmap>
#include <QRectF>

class OldGuy : public QGraphicsItem
{
public:
    OldGuy(QGraphicsScene *scene);
    virtual QRectF boundingRect() const;
    virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = nullptr);
    void updateDeathAnimation();
    void setState(double ro);
    void Shooting();

    int isdeath;


    QString root;
    double shootspeed;
    int shootrecord;
    // 初始化弹夹
    QList<Bullet*> bulletlist;
    // 用来存储小人走路三种状态的图片
    QList<QList<QString>> state;
    int state_index1;  // 记录小人面向的方向
    int state_index2;  // 记录小人当前处于哪一种移动状态
    int state_time;
    //死亡动画
    QList<QPixmap> deathlist;
    QList<QPixmap> deathbloodlist;

    QPointF position;
    double rotate;
    double opacity;
    int i; //死亡图片的下标

    QPixmap pix;
    // 死亡后的尸体
    QPixmap oldguydeadbody;

};

#endif // OLDGUY_H
